<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id="app">
    <common-head></common-head>
  </div>
  <script src="./vue.js"></script>
  <script>

    const Logo = {
      template: `
        <div>
            <h3>这是一个logo组件</h3>
            {{ a }}
        </div>
      `,
      inject: ['a', 'b', 'c'],
      mounted() {
        console.log(this, 222);
      }
    }
    const CommonHead = {
      // 父组件中通过 子组件标签的自定义属性 传递数据
      template: `
        <div>
          <h2 ref="title">我是父组件1</h2> 
          <logo></logo>
         
        </div>
      `,
      // 父组件 provide向外暴露多个数据 
      provide: {
        a: 10,
        b: 20,
        c: [1,2,3]
      },
      components: {
        Logo
      }
    };

    Vue.component('CommonHead', CommonHead);

    const vm = new Vue({
      el: '#app'
    })

  </script>
</body>

</html>